Skip to main content
Speculative decoding accelerates token generation by predicting multiple tokens ahead of the main model, then verifying them in a single batch. Because batch-processing tokens (as in prompt processing) is faster than generating them sequentially, correct draft predictions result in a net speedup. The higher the acceptance rate, the greater the gain. llama-server supports several speculative decoding implementations. A draft model can also be combined with a draftless implementation — when combined, the draftless type takes precedence.

Implementations

Draft model (draft)

A small secondary model (the draft model) generates candidate tokens that the main model then verifies in a batch. This is the most widely used speculative decoding approach and works well across all kinds of content.When to use: general-purpose acceleration where a suitable small draft model exists for your target model family.
Key flags:
  • --model-draft — path to the draft model GGUF
  • --draft-max / --draft — maximum tokens to draft per step (default: 16)
  • --draft-min — minimum draft length before the main model verifies
  • --draft-p-min — minimum probability threshold for greedy draft selection (default: 0.8)

Key command-line flags

--spec-type values

Statistics output

Each speculative decoding implementation prints statistics at the end of each request. Use them to tune your configuration. Draft model + ngram-simple combined:
ngram-mod:
ngram-map-k:
Field definitions: A high #acc tokens / #gen tokens ratio means your draft configuration is well-suited to the content. If the ratio is low, try a different --spec-type, adjust --spec-ngram-size-n, or reduce --draft-max.